/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.util.List;
import entity.Weather;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;


@Stateless
public class WeatherManager {

    @PersistenceContext
    private EntityManager em;
    
  
    public String getImageWeather(String meteo) {
        
        List<Weather> w = em.createNamedQuery(Weather.FIND_BY_DESCRIPTION, Weather.class).setParameter("description", meteo).getResultList(); 
        if(w.size()<1)
            return "";
        else{
            return w.get(0).getImage();
        }
    }
}

